package com.ksyzt.ksite2.server.common;

public class PageNaviData {

	public PageNaviData(String baseurl, long count, long pagesize,
			long currentpage) {
		this.baseurl = baseurl;
		this.count = count;
		this.currentpage = currentpage;
		this.pagesize = pagesize >= 0 ? pagesize : 20;
		calTotalPage();
	}

	private long count;
	private String baseurl;
	private long totalpage;
	private long currentpage;
	private long pagesize;

	public long getTotalPage() {
		return totalpage;
	}

	public long getPageSize() {
		return pagesize;
	}

	public String getBaseURL() {
		return baseurl;
	}

	public long getCurrentPage() {
		return currentpage;
	}

	private void calTotalPage() {
		if (count == 0) {
			totalpage = -1;
		} else {
			long last = count % pagesize;
			if (last > 0) {
				totalpage = count / pagesize + 1;
			} else {
				totalpage = count / pagesize;
			}
		}

	}
}
